<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<style>
    .tablenes .tt{width: 15%!important;}
    .tablenes .tv{width: 35%!important;}
</style>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title"><span>基本信息</span><span onclick="go_to_engin_xiang()" class="colorlan" style="float: right;margin-right: 12px">查看工程概况</span></div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">工程名称</td><td id="enginname" class="tv colorlan"></td><td class="tt">工程编号</td><td id="engin_number" class="tv"></td></tr>
                <tr><td class="tt">业务归属</td><td id="engin_gui_unit_name" class="tv"></td><td class="tt">工程管理文件汇编</td><td id="engin_neiname" class="tv colorlan"></td></tr>
                <tr><td class="tt">工程负责人</td><td id="engin_gofuer" class="tv"></td><td class="tt">负责人联系电话</td><td id="engin_gofutel" class="tv"></td></tr>
                <tr><td class="tt">中标价/施工合同金额(元)</td><td id="engin_shimoney" class="tv"></td><td class="tt">施工合同结算金额(元)</td><td id="engin_shijiefee" class="tv"></td></tr>
                </tbody>
            </table>
        </div>



        <div class="table-box tablenes">
            <div class="title">本工程回款资金池信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">本工程累计工程回款(元)</td><td id="engin_hougonghuimoney" class="tv"></td><td class="tt">累计回款金额占比(%)</td><td id="engin_leihuibi" class="tv"></td></tr>
                <tr><td class="tt">本工程回款累计支付(元)</td><td id="engin_hougongzhimoneyquben" class="tv"></td><td class="tt">本工程回款累计收取(元)</td><td id="engin_hougonghuikoufee" class="tv"></td></tr>
                <tr><td class="tt">本工程预留金额(元)</td><td id="engin_jiedongkoufee" class="tv"></td><td class="tt">本工程回款可用余额(元)</td><td id="engin_gonghui_keyu" class="tv"></td></tr>
                </tbody>
            </table>
        </div>


        <div class="table-box tablenes">
            <div class="title">销项票信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">已开具销项发票金额(元)</td><td id="engin_piaokaifee" class="tv"></td><td class="tt">已开具销项发票占比(%)</td><td id="engin_leixiaobi" class="tv"></td></tr>
                </tbody>
            </table>
        </div>


        <div class="table-box tablenes">
            <div class="title">本次回款信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">款项摘要</td><td id="zhai" class="tv"></td><td class="tt">款项类型</td><td id="shougonglei_name" class="tv"></td></tr>
                <tr><td class="tt"> 到账金额(元)</td><td id="money" class="tv"></td><td class="tt">到账方式</td><td id="incdaotype_name" class="tv"></td></tr>
                <tr><td class="tt">到账账户</td><td id="accid_name" class="tv"></td><td class="tt">到账日期</td><td id="dt" class="tv"></td></tr>
                <tr><td class="tt">本次回款占用销项票金额(元)</td><td class="tv" id="xiaofee" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">收取信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">本次回款是否收取</td><td class="tv" id="iskou" colspan="3"></td></tr>
                <tr class="layui-hide iskouinfo"><td class="tt">本次收取款项类型</td><td id="koulei_name" class="tv"></td><td class="tt">本次收取合计</td><td id="koufee" class="tv"></td></tr>
                </tbody>
            </table>
        </div>


        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">关联销项票明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide fuwu_list">
            <script type="text/html" id="toolbarDemo_fuwu_list">收取明细-待收取劳务分包服务费</script>
            <div class="tableShow">
                <table id="fuwu_list" lay-filter="fuwu_list"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide shuifei_list">
            <script type="text/html" id="toolbarDemo_shuifei_list">收取明细-待收取税款(含利息)</script>
            <div class="tableShow">
                <table id="shuifei_list" lay-filter="shuifei_list"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide gongjie_list">
            <script type="text/html" id="toolbarDemo_gongjie_list">收取明细-待收取工程负责人借款(含利息)</script>
            <div class="tableShow">
                <table id="gongjie_list" lay-filter="gongjie_list"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide kuaifei_list">
            <script type="text/html" id="toolbarDemo_kuaifei_list">收取明细-待收取快递费</script>
            <div class="tableShow">
                <table id="kuaifei_list" lay-filter="kuaifei_list"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide qifei_list">
            <script type="text/html" id="toolbarDemo_qifei_list">收取明细-直接收取</script>
            <div class="tableShow">
                <table id="qifei_list" lay-filter="qifei_list"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;
    var pub_enginid;
    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_hou_gonghui_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                var account = res.data.account;

                if(engininfo){
                    pub_enginid = engininfo.id
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });

                    $('#engin_number').text(engininfo.number);
                    $('#engin_gui_unit_name').text(engininfo.gui_unit_name);
                    $('#engin_gofuer').text(engininfo.gofuer);
                    $('#engin_gofutel').text(engininfo.gofutel);
                    if(engininfo.shiinfo){
                        $('#engin_shimoney').text(engininfo.shiinfo.money);
                    }
                    $('#engin_shijiefee').text(engininfo.shijiefee);

                    if(engininfo.neiinfo){
                        $("#engin_neiname").text(engininfo.neiinfo.name).click(function () {
                            openPage('../contract_nei/show.php?id='+engininfo.neiinfo.id);
                        });
                    }
                    $('#engin_piaokaifee').text(engininfo.piaokaifee);
                    $('#engin_leixiaobi').text(engininfo.leixiaobi);

                    $('#engin_hougonghuimoney').text(engininfo.hougonghuimoney);
                    $('#engin_leihuibi').text(engininfo.leihuibi);
                    $('#engin_hougongzhimoneyquben').text(engininfo.hougongzhimoneyquben);
                    $('#engin_hougonghuikoufee').text(engininfo.hougonghuikoufee);
                    $('#engin_jiedongkoufee').text(engininfo.jiedongkoufee);
                    $('#engin_gonghui_keyu').text(engininfo.gonghui_keyu);
                }

                if(account){
                    $('#accid_name').text(account.name+'('+account.accnum+')').click(function () {
                        openPage('../account/show.php?id='+account.id);
                    });
                }



                $("#zhai").text(data.zhai);
                $("#shougonglei_name").text(data.shougonglei_name);
                $("#money").text(data.money);
                $("#incdaotype_name").text(data.incdaotype_name);
                $("#dt").text(data.dt);
                $("#xiaofee").text(data.xiaofee);
                $("#iskou").text(data.iskou);
                $("#explain").text(data.explain);
                // $(".pageshowtitle").text('工程回款');


                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'nums', title: '发票号码'}
                        ,{field: 'shouer', title: '受票单位'}
                        ,{field: 'qianpiaotype_name', title: '发票类型'}
                        ,{field: 'money', title: '价税合计(元)'}
                        ,{field: 'yihuikuan', title: '已回款金额(元)'}
                        ,{field: 'daihuikuan', title: '待回款金额(元)'}
                        ,{field: 'xiaofee', title: '本次回款占用开票金额(元)'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });



                if(data.iskou == '是'){
                    $(".iskouinfo").removeClass('layui-hide');
                    $("#koulei_name").text(data.koulei_name);
                    $("#koufee").text(data.koufee);

                    if(in_array('fuwu', data.kouleiArr)){
                        $(".fuwu_list").removeClass('layui-hide');

                        var fuwu_list_List = table.render({
                            elem: "#fuwu_list",data:res.data.fuwu_list, toolbar: '#toolbarDemo_fuwu_list', page: false
                            ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                            ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                            ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                            , cols: [[
                                {type:'numbers',title:'序号',fixed:'left'}
                                ,{field: 'name', title: '费用所属工程名称'}
                                ,{field: 'houkoulei_name', title: '款项类型'}
                                ,{field: 'shimoney', title: '施工合同金额(元)'}
                                ,{field: 'shijiemoney', title: '施工合同结算金额(元)'}
                                ,{field: 'ratefu', title: '劳务分包服务费率(%)'}
                                ,{field: 'yingkoufee', title: '累计应收取(元)'}
                                ,{field: 'yikoufee', title: '累计已收取(元)'}
                                ,{field: 'daikoufee', title: '待收取(元)'}
                                ,{field: 'koufee', title: '本次收取(元)'}
                                ,{field: 'kouxing', title: '收取性质'}
                                ,{field: 'shoubiao', title: '收取标准'}
                                ,{field: 'explain', title: '款项说明'}
                            ]]
                            , done: function (res) {
                                soulTable.render(this);
                            }
                        });
                    }

                    if(in_array('shuifei', data.kouleiArr)){
                        $(".shuifei_list").removeClass('layui-hide');

                        var shuifei_list_List = table.render({
                            elem: "#shuifei_list",data:res.data.shuifei_list, toolbar: '#toolbarDemo_shuifei_list', page: false
                            ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                            ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                            ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                            , cols: [[
                                {type:'numbers',title:'序号',fixed:'left'}
                                ,{field: 'enginname', title: '费用所属工程名称'}
                                ,{field: 'name', title: '税款承诺书名称'}
                                ,{field: 'shendt', title: '申请日期'}
                                ,{field: 'xiaofee', title: '销项票开票金额(元)'}
                                ,{field: 'dt', title: '开票日期'}
                                ,{field: 'baofee', title: '税款保证金金额(元)'}
                                ,{field: 'houkoulei_name', title: '款项类型'}
                                ,{field: 'koufee', title: '本次收取(元)'}
                                ,{field: 'kouxing', title: '收取性质'}
                                ,{field: 'shoubiao', title: '收取标准'}
                                ,{field: 'explain', title: '款项说明'}
                            ]]
                            , done: function (res) {
                                soulTable.render(this);
                            }
                        });
                    }

                    if(in_array('gongjie', data.kouleiArr)){
                        $(".gongjie_list").removeClass('layui-hide');

                        var gongjie_list_List = table.render({
                            elem: "#gongjie_list",data:res.data.gongjie_list, toolbar: '#toolbarDemo_gongjie_list', page: false
                            ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                            ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                            ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                            , cols: [[
                                {type:'numbers',title:'序号',fixed:'left'}
                                ,{field: 'houkoulei_name', title: '款项类型'}
                                ,{field: 'number', title: '合同编号'}
                                ,{field: 'chuer', title: '出借方'}
                                ,{field: 'money', title: '借款金额(元)'}
                                ,{field: 'startdt', title: '借款期起'}
                                ,{field: 'enddt', title: '借款期止'}
                                ,{field: 'fangkuandt', title: '放款日期'}
                                ,{field: 'yueshu', title: '借款周期数'}
                                ,{field: 'money', title: '应还本金(元)'}
                                ,{field: 'lixifee', title: '应还利息(元)'}
                                ,{field: 'yinghuanfee', title: '应还合计(元)'}
                                ,{field: 'youfee', title: '利息优惠(元)'}
                                ,{field: 'koufee', title: '本次收取(元)'}
                                ,{field: 'kouxing', title: '收取性质'}
                                ,{field: 'shoubiao', title: '收取标准'}
                                ,{field: 'explain', title: '款项说明'}
                            ]]
                            , done: function (res) {
                                soulTable.render(this);
                            }
                        });
                    }

                    if(in_array('kuaifei', data.kouleiArr)){
                        $(".kuaifei_list").removeClass('layui-hide');

                        var kuaifei_list_List = table.render({
                            elem: "#kuaifei_list",data:res.data.kuaifei_list, toolbar: '#toolbarDemo_kuaifei_list', page: false
                            ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                            ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                            ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                            , cols: [[
                                {type:'numbers',title:'序号',fixed:'left'}
                                ,{field: 'houkoulei_name', title: '款项类型'}
                                ,{field: 'enginname', title: '费用所属工程名称'}
                                ,{field: 'kuailei', title: '收寄类型'}
                                ,{field: 'yunnum', title: '运单号'}
                                ,{field: 'kuaidt', title: '收寄日期'}
                                ,{field: 'futype', title: '付款方式'}
                                ,{field: 'kuaifee', title: '快递费用(元)'}
                                ,{field: 'koufee', title: '本次收取(元)'}
                                ,{field: 'kouxing', title: '收取性质'}
                                ,{field: 'shoubiao', title: '收取标准'}
                                ,{field: 'explain', title: '款项说明'}
                            ]]
                            , done: function (res) {
                                soulTable.render(this);
                            }
                        });
                    }

                    if(in_array('qifei', data.kouleiArr)){
                        $(".qifei_list").removeClass('layui-hide');

                        var qifei_list_List = table.render({
                            elem: "#qifei_list",data:res.data.qifei_list, toolbar: '#toolbarDemo_qifei_list', page: false
                            ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                            ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                            ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                            , cols: [[
                                {type:'numbers',title:'序号',fixed:'left'}
                                ,{field: 'houkoulei_name', title: '款项类型'}
                                ,{field: 'enginname', title: '费用所属工程名称'}
                                ,{field: 'koufee', title: '本次收取(元)'}
                                ,{field: 'kouxing', title: '收取性质'}
                                ,{field: 'shoubiao', title: '收取标准'}
                                ,{field: 'explain', title: '款项说明'}
                            ]]
                            , done: function (res) {
                                soulTable.render(this);
                            }
                        });
                    }
                }







                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('hou_gonghui', param_id);
    });


    function go_to_engin_xiang(){
        if(pub_enginid){
            openPage('../engin/xiang.php?id='+pub_enginid);

        }else{
            facade.error("暂无工程信息");return false;
        }
    }
</script>
</body>
</html>




